package com.mawc.equipower.soket;

/**
 * @Author: zhouhe
 * @Date: 2019/4/8 9:30
 */

import com.mawc.equipower.config.ContantConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.io.DataOutputStream;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * 负责发送数据
 */
@Component
public class SocketSendMsg {

    @Autowired
    private ContantConfig contantConfig;



    private static final String HOST = "127.0.0.1";
    private static final int PORT = 6665;

    private static String msg="40110300000001300400000000000803000000001401000BFF0001FFFFFFFFFFFF01017023";

    public static  void sendMsg() {
        ServerSocket server = null;
        Socket socket = null;
        DataOutputStream out = null;
        try {
            socket = new Socket(HOST, PORT);
            out = new DataOutputStream(socket.getOutputStream());
            out.writeUTF(msg);
            out.flush();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    public static void main(String []args){
        sendMsg();
    }
}